<extend name="Public/base"/>

<block name="body">
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>{$meta_title} [<a href="{:U('edit?id='.$info['id'])}">{$info.title}</a>]</h2>
	</div>
	<div class="data-table table-striped">
		<form id="form" action="__SELF__" method="post" class="form-horizontal">
		<input type="hidden" name="cal_id" value="{$info.id}" />
		<div class="category">
			<div class="hd cf">
				<div class="fold">折叠</div>
				<div class="order"><input class="check-all" type="checkbox"/></div>
				<div class="name" style="width: 300px;">用户组名称</div>
				<div class="name" style="width: 150px;">派发时间</div>
				<div class="name" style="width: 150px;">完成状态</div>
				<div class="name" style="width: 150px;">完成时间</div>
				<div class="name">查看</div>
			</div>
			<dl class="cate-item">
				<volist name="_glist" id="gl">
				<dt class="cf">
					<div class="fold zd"><i></i></div>
					<div class="order"><input class="ids sel-chd" type="checkbox"/></div>
					<div class="name">{$gl.title}</div>
				</dt>
				<dd style="display: none;">
					<dl class="cate-item">
						<volist name="_user_list" id="ul">
						<eq name="ul.group_id" value="$gl.gid">
						<dt class="cf">
							<div class="fold"></div>
							<div class="order"><input class="ids" type="checkbox" name="to_uid[]" value="{$ul.uid}"></div>
							<div class="name" style="width: 300px;"><span class="tab-sign"></span>{$ul.nickname}</div>
							<div class="name" style="width: 150px;">{$ul.send_time|time_format}</div>
							<div class="name" style="width: 150px;">{$ul['process']?'已完成':'未完成'}</div>
							<div class="name" style="width: 150px;">{$ul.finish_time|time_format='Y-m-d'}</div>
							<eq name="ul.process" value="1">
							<div class="name"><a href="{:U('report?cid='.$info['id'].'&uid='.$ul['uid'])}">查看报告</a></div>
							</eq>
						</dt>
						</eq>
						</volist>
					</dl>
				</dd>
				</volist>
			</dl>
		</div>
		<div class="form-item">
			<div class="controls edit_sort_btn">
				<button class="btn submit-btn ajax-post" target-form="form-horizontal" type="submit">确 定</button>
				<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
			</div>
		</div>
		</form>
	</div>
</block>

<block name="script">
<script type="text/javascript">
	//选中已经分发过的用户
	var recUser = [{$recUser}];
		$('.ids').each(function(){
		if( $.inArray( parseInt(this.value,10),recUser )>-1 ){
			//$(this).closest('tr').remove();
			$(this).prop('checked',true);
			$(this).attr('name','xxxx');
		}
	});
	//用户组展开
	$(".zd i").addClass("icon-fold").click(function(){
		var self = $(this);
		if(self.hasClass("icon-unfold")){
			self.closest("dt").next('dd').slideUp("fast", function(){
				self.removeClass("icon-unfold").addClass("icon-fold");
			});
		} else {
			self.closest("dt").next('dd').slideDown("fast", function(){
				self.removeClass("icon-fold").addClass("icon-unfold");
			});
		}
	});
	
	$('.sel-chd').click(function(){
		$(this).closest('dt').next('dd').find('.ids').prop('checked',this.checked)
	})
	//左侧导航高亮
	highlight_subnav('{:U('Calendar/index')}');
</script>
</block>